package com.lilinling.yinzhi.user.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lilinling.yinzhi.user.entity.MakerInfoEntity;
import com.lilinling.yinzhi.user.service.MakerInfoService;
import com.lilinling.common.utils.PageUtils;
import com.lilinling.common.utils.R;



/**
 * maker信息
 *
 * @author lichenglin
 * @email lilinling15@gmail.com
 * @date 2021-01-19 22:19:30
 */
@RestController
@RequestMapping("user/makerinfo")
public class MakerInfoController {
    @Autowired
    private MakerInfoService makerInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @ApiOperation(value = "maker列表")
    //@RequiresPermissions("user:makerinfo:list")
    public R list(@RequestBody @RequestParam Map<String, Object> params){
        PageUtils page = makerInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("user:makerinfo:info")
    public R info(@PathVariable("id") Long id){
		MakerInfoEntity makerInfo = makerInfoService.getById(id);

        return R.ok().put("makerInfo", makerInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("user:makerinfo:save")
    public R save(@RequestBody MakerInfoEntity makerInfo){
        makerInfoService.save(makerInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("user:makerinfo:update")
    public R update(@RequestBody MakerInfoEntity makerInfo){
		makerInfoService.updateById(makerInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("user:makerinfo:delete")
    public R delete(@RequestBody Long[] ids){
		makerInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
